package cn.iocoder.yudao.module.system.service.expert;

import cn.iocoder.yudao.module.system.dal.dataobject.expert.ExpertDO;
import cn.iocoder.yudao.module.system.dal.dataobject.expert.SystemWrittenExamExpertRelDO;
import cn.iocoder.yudao.module.system.dal.mysql.expert.SystemWrittenExamExpertRelMapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

@Service
public class SystemWrittenExamExpertRelServiceImpl implements SystemWrittenExamExpertRelService {

    @Resource
    private SystemWrittenExamExpertRelMapper systemWrittenExamExpertRelMapper;
    @Resource
    private ExpertService expertService;

    @Override
    public List<ExpertDO> getExpertListByWrittenExamType(Integer writtenExamType) {
//        if (Objects.isNull(writtenExamType)) {
//            return new ArrayList<>();
//        }
//        LambdaQueryWrapper<SystemWrittenExamExpertRelDO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
//        lambdaQueryWrapper.eq(SystemWrittenExamExpertRelDO::getWrittenExamType, writtenExamType);
//        List<SystemWrittenExamExpertRelDO> systemWrittenExamExpertRelDOList = systemWrittenExamExpertRelMapper.selectList(lambdaQueryWrapper);
//        if (CollectionUtils.isEmpty(systemWrittenExamExpertRelDOList)) {
//            return new ArrayList<>();
//        }
//        List<Integer> expertTypes = systemWrittenExamExpertRelDOList.stream().map(SystemWrittenExamExpertRelDO::getExpertType).collect(Collectors.toList());
//        return expertService.selectByExpertTypes(expertTypes);
        // 0823 逻辑改变，type 固定写1
        return expertService.selectByExpertTypes(Arrays.asList(1));
    }

}
